package main.java.gui;

import javax.swing.SwingWorker;

public class Task extends SwingWorker<Integer, Integer>{
	
	int DELAY = 1000;
	
	@Override
	protected Integer doInBackground() throws Exception {
		int i = 0;
	    int count = 10;
	    while (!isCancelled() && i < count) {
	      i++;
	      publish(new Integer[] { i });
	      setProgress(count * i / count);
	      Thread.sleep(DELAY);
	    }
	    return count;
	}
}
